package conponent;

import module.Position;
import view.View;

import java.awt.*;

public abstract class EntityComp implements Entity {
    private int x;
    private int y;
    private int w;
    private int h;
    private Image show;
    private View loc;

    public EntityComp(){
        x=0;
        y=0;
        w=32;
        h=32;
    }

    public EntityComp(int x, int y, int w, int h, View loc,Image show) {
        this.x = x;
        this.y = y;
        this.w = w;
        this.h = h;
        this.loc = loc;
        this.show=show;
    }
    public EntityComp(int x, int y, View loc,Image show) {
        this.x = x;
        this.y = y;
        this.w = 32;
        this.h = 32;
        this.loc = loc;
        this.show=show;
    }

    public EntityComp(int x, int y) {
        this.x = x;
        this.y = y;
        this.w = 32;
        this.h = 32;
    }

    public EntityComp(int x, int y, View view) {
        this.x=x;
        this.y=y;
        this.w=32;
        this.h=32;
        this.loc=view;
    }

    public EntityComp(Image image,int x, int y) {
        this.x=x;
        this.y=y;
        this.w=32;
        this.h=32;
        this.show=image;
    }


    @Override
    public void setShow(Image show) {
        this.show = show;
    }

    @Override
    public void setLoc(View loc) {
        this.loc = loc;
    }

    @Override
    public Position getPosition() {
        return new Position(x,y,w,h);
    }

    @Override
    public Image disPlay() {
        return show;
    }

    @Override
    public View getView() {
        return loc;
    }

    @Override
    public void translate(int x, int y) {
        this.x+=x;
        this.y+=y;
    }

    public void setPosition(int x,int y){
        this.x=x;
        this.y=y;
    }
}
